
/********

Project - College affirmative action bans and health risk behaviors

Dataset - National Youth Risk Behavior Survey (YRBS)

Version - May 29, 2019 (for replication archive)

Description - This file contains the code used to generate all of the main and supplemental analyses using the YRBS reported
in the published paper. (The datafile used for analysis was created as outlined in "datasetup_YRBS.do").
We have heavily annotated the file to transparently guide the reader on specific choices made in the analysis.

To run this analysis, the user will need to install the following stata routines:
-outreg2-
-maptile-
-spmap-
-statastates-
-wyoung-

Where appropriate, we also include here some analyses that were not included in the original paper, so as to further illustrate
the reasoning behind our approach.

********/

***SET FILE PATHS AND CALL DATASET

global data "[YOUR FILEPATH]"  /*calls in all data used for the project */
global outreg "[YOUR FILEPATH]"  /*file to house data output*/

use "$data/yrbs_analysis_datafile.dta", clear


***********************************************************
******CREATE AFFIRMATIVE ACTION BAN EXPOSURE MEASURES
***********************************************************

**Main binary variable
gen aa_jel2016=.
replace aa_jel2016=0
replace aa_jel2016=1 if stfips==48 & year>=1997
replace aa_jel2016=0 if stfips==12 & year<2001
replace aa_jel2016=1 if stfips==12 & year>=2001
replace aa_jel2016=0 if stfips==06 & year<1998
replace aa_jel2016=1 if stfips==06 & year>=1998
replace aa_jel2016=0 if stfips==53 & year<1999
replace aa_jel2016=1 if stfips==53 & year>=1999
replace aa_jel2016=0 if stfips==26 & year<2006
replace aa_jel2016=1 if stfips==26 & year>=2006
replace aa_jel2016=0 if stfips==04 & year<2010
replace aa_jel2016=1 if stfips==04 & year>=2010
replace aa_jel2016=0 if stfips==33 & year<2012
replace aa_jel2016=1 if stfips==33 & year>=2012
replace aa_jel2016=0 if stfips==40 & year<2013
replace aa_jel2016=1 if stfips==40 & year>=2013
replace aa_jel2016=0 if stfips==31 & year<2008
replace aa_jel2016=1 if stfips==31 & year>=2008
sort year

*(Note - Texas had a favorable court ruling in 2003 that allowed for reinstitution affirmative action programs.
*However, many colleges still contonued without affirmative action programs and so we considered bans to be active for all years
*after 1997. In a specification check below, we used the below recoded measure where individuals surveyed after 2003 were considered 
*to be unexposed, finding similar results)

gen aa_alt = aa_jel
replace aa_alt = 0 if statefip==48&year>=2003

**Event study variables
gen year_ban=.
replace year_ban=1997 if stfips==48
replace year_ban=2001 if stfips==12
replace year_ban=1998 if stfips==06
replace year_ban=1999 if stfips==53
replace year_ban=2006 if stfips==26
replace year_ban=2008 if stfips==31
replace year_ban=2010 if stfips==04
replace year_ban=2012 if stfips==33
replace year_ban=2013 if stfips==40

tab year_ban, missing

gen aa_event=.
replace aa_event=year-year_ban
replace aa_event=. if year_ban==.
tab aa_event, missing

*Bin in two year increments given that YRBS is conducted only in odd years
*Bin event years before and including -7 and after +6 to ensure relative balance (does not change main estimates)

mark event_time1 if aa_event<=-7
mark event_time2 if (aa_event>=-6&aa_event<=-5)
mark event_time3 if (aa_event>=-4&aa_event<=-3)
mark event_time4 if ( aa_event>=-2&aa_event<=-1) /*reference year*/
mark event_time5 if (aa_event>=0&aa_event<=1)
mark event_time6 if aa_event>=2&aa_event<=3
mark event_time7 if aa_event>=4&aa_event<=5
mark event_time8 if aa_event>=6


*Mark states implementing bans at any time during the study period (for descriptive statistics purposes)
mark banst if year_ban~=.

*Identify states bordering those with affirmative action bans. This is for a specification check (below) where we allow for cross-border 
*spillovers; i.e., that students in Nevada, for example, may be affected by bans in California given their high application rates
*to University of California and California state institutions.

gen border=.
replace border=0
replace border=1 if stfips==35 & year>=1997
replace border=1 if stfips==40 & year>=1997
replace border=1 if stfips==05 & year>=1997
replace border=1 if stfips==22 & year>=1997
replace border=1 if stfips==01 & year>=2001
replace border=1 if stfips==13 & year>=2001
replace border=1 if stfips==41 & year>=1998
replace border=1 if stfips==32 & year>=1998
replace border=1 if stfips==04 & year>=1998
replace border=1 if stfips==41 & year>=1999
replace border=1 if stfips==16 & year>=1999
replace border=1 if stfips==01 & year>=2002
replace border=1 if stfips==12 & year>=2002
replace border=1 if stfips==47 & year>=2002
replace border=1 if stfips==45 & year>=2002
replace border=1 if stfips==37 & year>=2002
replace border=1 if stfips==55 & year>=2006
replace border=1 if stfips==39 & year>=2006
replace border=1 if stfips==18 & year>=2006
replace border=1 if stfips==06 & year>=2010
replace border=1 if stfips==08 & year>=2010
replace border=1 if stfips==32 & year>=2010
replace border=1 if stfips==35 & year>=2010
replace border=1 if stfips==49 & year>=2010
replace border=1 if stfips==50 & year>=2012
replace border=1 if stfips==23 & year>=2012
replace border=1 if stfips==25 & year>=2012
replace border=1 if stfips==48 & year>=2013
replace border=1 if stfips==35 & year>=2013
replace border=1 if stfips==08 & year>=2013
replace border=1 if stfips==20 & year>=2013
replace border=1 if stfips==29 & year>=2013
replace border=1 if stfips==05 & year>=2013
replace border=1 if stfips==08 & year>=2008
replace border=1 if stfips==20 & year>=2008
replace border=1 if stfips==56 & year>=2008
replace border=1 if stfips==46 & year>=2008
replace border=1 if stfips==19 & year>=2008
replace border=1 if stfips==29 & year>=2008

*Exclude from estimation sample states that considered, but did not pass, affirmative action bans over a long period of time.
*Specifically, these are states that had multi-year litigation around affirmative action. 
*We note that Colorado considered an affirmative action ban as part of a voter initiative in 2008 that was narrowly defeated. We
*do not exclude Colorado though given that the ban was only considered over a short time frame (<1 year). (The reader can verify that
*excluding Colorado does not change the results at all)
 
gen est_sample = 1
recode est_sample (1=.) if stfip==1|stfip==13|stfip==22|stfip==28

*Missing data - remove observations with missing states, sex, grade:
drop if statefip==.
drop if grade==.
drop if sex==.

*Identify outcomes, covariates in shorthand globals (i.e., apply to rest of this file and stata session, unless they are
*redefined)
global outcomes "smoke_n_cat alc_n_cat binge"
global indiv "i.age i.race6 i.sex i.grade"
global survey "i.year*i.race6"
global trends "i.stfip*year"
global policies "ln_real_pci ln_cigtax ln_beertax unemp"


******************************
*****SUMMARY STATISTICS ******
******************************

**TABLE 1 (FIRST TWO COLUMNS) - SAMPLE DESCRIPTIVES
*Obtain both raw numbers + weighted percentages

log using "$outreg/Table_1_samplestats_YRBS"

*identify sample - we work with smoking sample for simplicity, since samples are slightly different
*here and throughout, grade > =3 refers to 11th grade (code = 3) and 12th grade (code = 4)
xi: areg smoke_n_cat aa_jel2016 $indiv $survey $trends  if race_min==2&grade>=3&est_samp==1 , abs(stfips) cluster(stfips)
mark urm_sample if e(sample)

tab aa_jel if race_min==2&grade>=3&urm_sample==1
tab aa_jel if race_min==2&grade>=3&urm_sample==1 [aw = weight]

bysort banst: sum age if race_min==2&grade>=3&urm_sample==1 [aw = weight]

bysort banst: tab sex if race_min==2&grade>=3&urm_sample==1
bysort banst: tab sex if race_min==2&grade>=3&urm_sample==1 [aw = weight]

bysort banst: tab grade if race_min==2&grade>=3&urm_sample==1
bysort banst: tab grade if race_min==2&grade>=3&urm_sample==1 [aw = weight]

bysort banst: tab race6 if race_min==2&grade>=3&urm_sample==1
bysort banst: tab race6 if race_min==2&grade>=3&urm_sample==1 [aw = weight]

log close

**S3 TABLE - EXPOSED AND UNEXPOSED OUTCOMES BY WAVE-OUTCOME

quietly: xi: areg smoke_n_cat aa_jel2016 $indiv $survey $trends  if race_min==2&grade>=3&est_samp==1 , abs(stfips) cluster(stfips)
mark s_smoking if e(sample)
quietly: xi: areg alc_n_cat aa_jel2016 $indiv $survey $trends  if race_min==2&grade>=3&est_samp==1 , abs(stfips) cluster(stfips)
mark s_alc if e(sample)
quietly: xi: areg binge aa_jel2016 $indiv $survey $trends  if race_min==2&grade>=3&est_samp==1 , abs(stfips) cluster(stfips)
mark s_binge if e(sample)

foreach x in smoking alc binge {
	tab year aa_jel2016 if s_`x'==1
	}


**********************************
******MAIN DD REGRESSION ANALYSES*
**********************************

*TABLE 1 - MAIN DD ESTIMATES (First three columns)

*Under-represented minority sample (black, Hispanic, Native American)
foreach x of global outcomes {

	xi: areg `x' aa_jel2016 $indiv $survey $trends  if race_min==2&grade>=3&est_samp==1 , abs(stfips) cluster(stfips)
	outreg2 using "$outreg/aa_ban_COREDD_URM", excel stats(coef ci pval se) 	
	
	}
		
	
*Non Hispanic white Sample
foreach x of global outcomes {
		
	xi: areg `x' aa_jel2016 $indiv $survey $trends  if race_min==1&grade>=3&est_samp==1 , abs(stfips) cluster(stfips)
	outreg2 using "$outreg/aa_ban_COREDD_WHITE", excel stats(coef ci pval se) 
	
	}
	
*Multiple comparisons
	*Compute Sidak-Holm FWER corrected p-value	
	*-wyoung- computes these, in addition to Bonferoni-Holm, Westfall Young - we ex ante chose Sidak-Holm, but leave
	*the reader to view all possibilities here
	xi: wyoung smoke_n_cat alc_n_cat binge, cmd(areg OUTCOMEVAR aa_jel2016 $indiv $survey $trends if race_min==2&(grade>=3)&est_samp==1 , abs(stfips) cluster(stfips)) familyp(aa_jel2016) bootstraps(100) seed(20) cluster(stfips)
	xi: wyoung smoke_n_cat alc_n_cat binge, cmd(areg OUTCOMEVAR aa_jel2016 $indiv $survey $trends if race_min==1&(grade>=3)&est_samp==1 , abs(stfips) cluster(stfips)) familyp(aa_jel2016) bootstraps(100) seed(20) cluster(stfips)

	*We also considered during a revision and omnibus test, following, Kling et al, Econometrica, 2007
	*This approach creates a normalized index for each variable and then sums across these indices
	*We note here that we do not account for missing data here - this is mainly illustrative to show that the
	*impacts for the family of outcomes is statistically significant
	
	foreach x of varlist smoke_n_cat alc_n_cat binge {

	egen temp_mean = mean(`x') if race_min==2&grade>=3&banst==0
	egen temp_sd = sd(`x') if race_min==2&grade>=3&banst==0
	egen mean_`x'_urm = max(temp_mean) if race_min==2&grade>=3
	egen sd_`x'_urm = max(temp_sd) if race_min==2&grade>=3

	gen norm_`x'_urm = (`x'-mean_`x'_urm)/sd_`x'_urm if race_min==2&grade>=3

	drop temp* mean_*_urm sd_*_urm

	egen temp_mean = mean(`x') if race_min==1&grade>=3&banst==0
	egen temp_sd = sd(`x') if race_min==1&grade>=3&banst==0
	egen mean_`x'_white = max(temp_mean) if race_min==1&grade>=3
	egen sd_`x'_white = max(temp_sd) if race_min==1&grade>=3

	gen norm_`x'_white = (`x'-mean_`x'_white)/sd_`x'_white if race_min==1&grade>=3

	drop temp* mean_*_white sd_*_white

	}

	gen normalized_urm = norm_smoke_n_cat_urm + norm_alc_n_cat_urm + norm_binge_urm
	gen normalized_white = norm_smoke_n_cat_white + norm_alc_n_cat_white + norm_binge_white
	
	xi: areg normalized_urm aa_jel2016 $indiv $survey $trends  if race_min==2&grade>=3&est_samp==1 , abs(stfips) cluster(stfips)
	xi: areg normalized_white aa_jel2016 $indiv $survey $trends  if race_min==1&grade>=3&est_samp==1 , abs(stfips) cluster(stfips)
	

*************************************************************************
******ADDITIONAL ANALYSIS AND SPECIFICATION CHECKS FOR MAIN DD MODEL*****
*************************************************************************

/*

List of additional analyses or checks and corresponding table in paper:

2. Race/ethnicity and gender regressions - S4 Table
3. Spec changes - acct for border spillovers; addition of state-year policies; own controls; recoding Texas exposure - S5 Table
4. Including sampling weights - S8 Table

*/

***S4 TABLE - RACE ETHNCITY GENDER SPECIFIC MODELS

*Race Heterogeneity
	
	forvalues y = 1/3 {
		foreach x of global outcomes {
		
		xi: areg `x' aa_jel2016 $indiv $survey $trends  if race6==`y'&est_samp==1&grade>=3  , abs(stfips) cluster(stfips)
		outreg2 using "$outreg/aa_ban_RACEETHDD", excel stats(coef ci pval se) 
		
		}
		}	
	
*Gender Hetergeneity

	forvalues y = 1/2{
	
		foreach x of global outcomes {
	
		xi: areg `x' aa_jel2016 $indiv $survey $trends  if race_min==2&sex==`y'&est_samp==1&grade>=3  , abs(stfips) cluster(stfips)
		outreg2 using "$outreg/aa_ban_GENDERDD_URM", excel stats(coef ci pval se) 	
		
		}
		}

***S5 TABLE - SPECIFICATION CHECKS

	
	foreach x of global outcomes {
	
		*Add in state-year covariates
		xi: areg `x' aa_jel2016 $indiv $survey $trends $policies  if race_min==2&est_samp==1&grade>=3  , abs(stfips) cluster(stfips)
		outreg2 using "$outreg/aa_ban_COREDD_ROBUST_URM", excel stats(coef ci pval se) 

		*Allow for separate effects in border states
		xi: areg `x' aa_jel2016 border $indiv $survey $trends  if race_min==2&est_samp==1&grade>=3  , abs(stfips) cluster(stfips)
		outreg2 using "$outreg/aa_ban_COREDD_ROBUST_URM", excel stats(coef ci pval se) 
		
		*Use recoded variable which specifies no exposure in Texas after 2003
		xi: areg `x' aa_alt  $indiv $survey $trends  if race_min==2&est_samp==1&grade>=3  , abs(stfips) cluster(stfips)
		outreg2 using "$outreg/aa_ban_COREDD_ROBUST_URM", excel stats(coef ci pval se) 
		
		*Restrict to only those states that implemented bans
		xi: areg `x' aa_jel2016 $indiv $survey $trends  if race_min==2&est_samp==1&banst==1&grade>=3  , abs(stfips) cluster(stfips)
		outreg2 using "$outreg/aa_ban_COREDD_ROBUST_URM", excel stats(coef ci pval se) 
		
		
		}

	/* This is not in the main paper, but here are the same checks for the non-Hispanic White sample 
	
	*White Sample
	foreach x of global outcomes {
	
		xi: areg `x' aa_jel2016 $indiv $survey $trends $policies  if race_min==1&est_samp==1&grade>=3  , abs(stfips) cluster(stfips)
		outreg2 using "$outreg/aa_ban_COREDD_ROBUST_WHITE", excel stats(coef ci pval se) 
		
		xi: areg `x' aa_jel2016 border $indiv $survey $trends  if race_min==1&est_samp==1&grade>=3  , abs(stfips) cluster(stfips)
		outreg2 using "$outreg/aa_ban_COREDD_ROBUST_WHITE", excel stats(coef ci pval se) 

		xi: areg `x' aa_alt  $indiv $survey $trends  if race_min==1&est_samp==1&grade>=3  , abs(stfips) cluster(stfips)
		outreg2 using "$outreg/aa_ban_COREDD_ROBUST_URM", excel stats(coef ci pval se) 

		xi: areg `x' aa_jel2016 $indiv $survey $trends  if race_min==1&banst==1&grade>=3  , abs(stfips) cluster(stfips)
		outreg2 using "$outreg/aa_ban_COREDD_ROBUST_WHITE", excel stats(coef ci pval se) 
		}

		*/
	
***S8 Table - Including Weights
/*
Note - We follow Solon et al (2015) and Winship and Radbill (1994) and do NOT include weights in the main
model. This is for several reasons:

- Per YRBS website, weights are based on sex, grade, race and location - we control for all of these in our model in a flexible manner
- In this case, OLS is BLUE. No e/o of selective sampling on the dependent variable (which we also test for above)
- Weighting to correct for heteroskedasticity is dominated by use of robust standard errors when both OLS and WLS are consistent
- Weighting can reduce precision in situations where individual errors are clustered within states
- The results of the weighted analyses bear this out

*/
	
	foreach x of global outcomes {

		xi: areg `x' aa_jel2016  $indiv $survey $trends  if race_min==2&grade>=3 [aw = weight], abs(stfips) cluster(stfips)
		outreg2 using "$outreg/aa_ban_COREDD_WT_CHECK", excel stats(coef ci pval se) 
		
		}

*********************************************************
******EVENT STUDY ESTIMATES - FIGURE 2 and S2 FIGURE*****
*********************************************************

*Run main models, store coefficients

foreach x in $outcomes {

preserve

	*URM
	xi: areg `x'  event_time1-event_time3 event_time5-event_time8  $indiv $survey $trends  if race_min==2&grade>=3&est_samp==1, abs(stfips) cluster(stfips)
		gen y_u_coef_`x'4 = .
		gen y_u_sd_`x'4 = .
	foreach  i of numlist 1/3 5/8 {
		gen y_u_coef_`x'`i' = _b[event_time`i']
		gen y_u_sd_`x'`i' = _se[event_time`i']
		}
		
	*White
	xi: areg `x'  event_time1-event_time3 event_time5-event_time8  $indiv $survey $trends  if race_min==1&grade>=3&est_samp==1, abs(stfips) cluster(stfips)
		gen y_w_coef_`x'4 = .
		gen y_w_sd_`x'4 = .
	foreach  i of numlist 1/3 5/8 {
		gen y_w_coef_`x'`i' = _b[event_time`i']
		gen y_w_sd_`x'`i' = _se[event_time`i']
		}
		
	
	keep y_u* y_w*
	collapse (mean) *
	gen x=1
	reshape long y_u_coef_`x' y_u_sd_`x' y_w_coef_`x' y_w_sd_`x' , i(x) j(year)
	drop x	

	save "$outreg/temp_`x'.dta", replace
	
restore

}	

*Generate 95% CI and ready files for graphing

use "$outreg/temp_smoke_n_cat.dta", clear
foreach x in alc_n_cat binge {
merge 1:1 year using "$outreg/temp_`x'.dta",
drop _merge
}


foreach x in $outcomes {
gen upper_u_`x' = y_u_coef_`x' + 1.96*y_u_sd_`x'
gen lower_u_`x' = y_u_coef_`x' - 1.96*y_u_sd_`x'	
drop y_u_sd_`x'

gen upper_w_`x' = y_w_coef_`x' + 1.96*y_w_sd_`x'
gen lower_w_`x' = y_w_coef_`x' - 1.96*y_w_sd_`x'	
drop y_w_sd_`x'

}

recode y_* upper* lower* (.=0) if year==4

label define event_t 1 "-7+" 2 "-6/-5" 3 "-4/-3" 4 "-2/-1" 5 "0/1" 6 "2/3" 7 "4/5" 8 "6+"
label values year event_t

*Graphs
*(Note - we introduced titles for these graphs using the graph editor function)

foreach x in $outcomes {

*Figure 1
twoway (rline upper_u_`x' lower_u_`x' year if year<4, lcolor(navy) lpattern(dot)) ///
	(rline upper_u_`x' lower_u_`x' year if year>=5, lcolor(navy) lpattern(dot)) ///	
    (scatter y_u_coef_`x' year if year<=4, msymbol(diamond) msize(medlarge) recast(connected) lstyle(solid) lcolor(navy) mcolor(navy)) ///
	(scatter y_u_coef_`x' year if year>=5, msymbol(diamond) msize(medlarge) recast(connected) lstyle(solid) lcolor(navy) mcolor(navy)) ///	
	, legend(off) xtitle("Years Relative to Ban Implementation") xlabel(,labsize(medsmall)) ytitle("Coef Estimate") ylabel(,labsize(medsmall)) xline(4.5, lpattern(dash) lcolor(gs4)) yline(0, lpattern(dash) lcolor(gs4)) xlabel(1(1)8, valuelabel) ylabel(-0.1(0.05)0.15) graphregion(color(white)) bgcolor(white)

	graph save "$outreg/urm_`x'", replace 
	*graph export "$outreg/urm_`x'.tif", replace width(2550)

*S2 Figure
twoway (rline upper_w_`x' lower_w_`x' year if year<4, lcolor(maroon) lpattern(dot)) ///
	(rline upper_w_`x' lower_w_`x' year if year>=5, lcolor(maroon) lpattern(dot)) ///	
    (scatter y_w_coef_`x' year if year<=4, msymbol(square) msize(medlarge) recast(connected) lstyle(solid) lcolor(maroon) mcolor(maroon)) ///
	(scatter y_w_coef_`x' year if year>=5, msymbol(square) msize(medlarge) recast(connected) lstyle(solid) lcolor(maroon) mcolor(maroon)) ///	
	, legend(off) xtitle("Years Relative to Ban Implementation") xlabel(,labsize(medsmall)) ytitle("Coef Estimate") ylabel(,labsize(medsmall)) xline(4.5, lpattern(dash) lcolor(gs4)) yline(0, lpattern(dash) lcolor(gs4)) xlabel(1(1)8, valuelabel) ylabel(-0.1(0.05)0.15) graphregion(color(white)) bgcolor(white)

	graph save "$outreg/white_`x'", replace
	*graph export "$outreg/white_`x'.tif", replace width(2550)

	}
	

*Delete temporary files
foreach x in $outcomes {

erase "$outreg/temp_`x'.dta"

}

****************************************
*************MAPS - FIGURE 1************
****************************************

*FIRST RERUN DATA SET UP PART OF CODE! (FIRST SECTION)

collapse (mean) year_ban, by(statefip)
statastates, fip(statefip)
rename state_abbrev state

maptile year_ban, geo(state) resolution(4) nq(3) fcolor(Blues)
*(Note - we used the graph editor, to edit the legend text (e.g., removing commas))


/*******************
****EXTRA ANALYSES**
********************

*These are either mentioned in the supplement or were not presented in the paper but informed our work
		
*(1) Do AA Bans predict missingness of data? (i.e., selection into the sample)

mark missing_smk if smoke_n_cat==.
mark missing_alc if alc_n_cat==.
mark missing_binge if binge==.

xi: areg missing_smk aa_jel2016 $indiv $survey $trends  if race_min==2&grade>=3&est_samp==1 , abs(stfips) cluster(stfips)
xi: areg missing_alc aa_jel2016 $indiv $survey $trends  if race_min==2&grade>=3&est_samp==1 , abs(stfips) cluster(stfips)
xi: areg missing_binge aa_jel2016 $indiv $survey $trends  if race_min==2&grade>=3&est_samp==1 , abs(stfips) cluster(stfips)
		
*(2) All models include state-specific trends given length of study period + discrete nature of policy shock
*This choice can be further motivated by noting pre-existing (negative) trends in event study models that do not include
*state trends

	foreach x of global outcomes {
	
		xi: areg `x'  event_time1-event_time3 event_time5-event_time8  $indiv i.year  if race_min==2&grade>=3, abs(stfips) cluster(stfips)
		outreg2 using "$outreg/aa_ban_EVENT_URM", excel stats(coef ci pval se) 
		
		xi: areg `x'  event_time1-event_time3 event_time5-event_time8  $indiv i.year if race_min==1&grade>=3, abs(stfips) cluster(stfips)
		outreg2 using "$outreg/aa_ban_EVENT_WHITE", excel stats(coef ci pval se) 
	
		}
		
*(3) Additional falsification - assess impacts for 9th and 10th graders. We expected to see smaller impacts
*(if any) for these groups given that college decisions are less salient. Also, the psychology literature suggests
*that the early vs late high school years form discrete developmental stages, with the latter being a key period for the 
*formation of an adult identity with regards to many life choices, including the labor market.
*We find little (if any) evidence of impacts for these groups


	foreach x of global outcomes {
	
		xi: areg `x' aa_jel2016 $indiv $survey $trends  if race_min==2&grade<3&est_samp==1 , abs(stfips) cluster(stfips)
		outreg2 using "$outreg/aa_ban_FULLSAMP_URM", excel stats(coef ci pval se) 

		xi: areg `x' aa_jel2016 $indiv $survey $trends  if race_min==1&est_samp==1&grade<3  , abs(stfips) cluster(stfips)
		outreg2 using "$outreg/aa_ban_FULLSAMP_WHT", excel stats(coef ci pval se) 
		
		}

*(4) Selection on observables - do affirmative action bans change sample composition? We do not find any evidence of substantive
or statistically meaningful differences in the probability of reporting certain demographic characteristics by assigned
exposure to affirmative action bans.

gen female = sex
recode female (2=0)
gen minority = race_min
recode minority (2=1) (1=0) (3=0)
gen grade12 = grade
recode grade12 (4=1) (3=0) (1/2 = .)


	foreach x of varlist minority female age grade12  {

		xi: areg `x' aa_jel2016  i.year $trends if est_samp==1 , abs(stfips) cluster(stfips)
		outreg2 using "$outreg/aa_ban_SELECTION_ALL", excel stats(coef ci pval se) 
		
		xi: areg `x' aa_jel2016  i.year $trends if grade>=3&est_samp==1 , abs(stfips) cluster(stfips)
		outreg2 using "$outreg/aa_ban_SELECTION_ALL", excel stats(coef ci pval se) 

		}
		
			
	foreach x of varlist age female grade12 {

		xi: areg `x' aa_jel2016  $survey $trends if race_min==2&est_samp==1 , abs(stfips) cluster(stfips)
		outreg2 using "$outreg/aa_ban_SELECTION_URM", excel stats(coef ci pval se) 
		
		xi: areg `x' aa_jel2016 $survey $trends if race_min==2&grade>=3&est_samp==1 , abs(stfips) cluster(stfips)
		outreg2 using "$outreg/aa_ban_SELECTION_URM", excel stats(coef ci pval se) 
		
		}
		*/
